package com.itchen.service;

import com.itchen.mapper.provinceMapper;
import com.itchen.pojo.City;
import com.itchen.pojo.Province;
import com.itchen.util.SqlSessionFactoryUtils;
import org.apache.ibatis.session.SqlSession;

import java.util.List;

/**
 * @author げっしょく
 * @date 2021/9/6
 */
public class ProvinceService {

    public List<Province> selectAll(){
        SqlSession sql = SqlSessionFactoryUtils.getSqlSession();

        provinceMapper mapper = sql.getMapper(provinceMapper.class);

        List<Province> provinces = mapper.selectAll();

        return provinces;

    }

    public List<City> selectCity(int id) {
        SqlSession sql = SqlSessionFactoryUtils.getSqlSession();

        provinceMapper mapper = sql.getMapper(provinceMapper.class);

        List<City> cities = mapper.selectCity(id);
        return cities;
    }
}
